package com.tust.controller;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class MenuController {
    @RequestMapping("/goToModel.do")
    public ModelAndView goToModel(@Param("modelName") String modelName, @Param("userName") String userName) {
        ModelAndView mv = new ModelAndView();
        if (modelName.equals("学生信息录入")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",1);
            mv.setViewName("setStudentInfo");
        } else if (modelName.equals("教师信息录入")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",1);
            mv.setViewName("setTeacherInfo");
        } else if (modelName.equals("课程信息录入")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",1);
            mv.setViewName("setCourseInfo");
        } else if (modelName.equals("学生选课操作")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",1);
            mv.setViewName("studentSelection");
        } else if (modelName.equals("教师授课操作")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",1);
            mv.setViewName("teacherSelection");
        } else if (modelName.equals("学生课程成绩")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",1);
            mv.setViewName("studentGrade");
        } else if (modelName.equals("教学管理系统")) {
            mv.addObject("modelName",modelName);
            mv.addObject("userName",userName);
            mv.addObject("animate",0);
            mv.setViewName("manageSys");
        }
        return mv;
    }
}
